package rxb.demo.wzyservice.wzyimpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import rxb.demo.wzyentity.Food;
import rxb.demo.mapper.FoodMapper;
import rxb.demo.wzyservice.IFoodService;

import java.util.List;

/**
 * Created by admin on 2019/12/28.
 */
@Service
public class FoodServiceImpl implements IFoodService{

    @Autowired
    private FoodMapper foodMapper;

    @Override
    public List<Food> findAll(){
        return foodMapper.findAll();
    }

    @Override
    public List<Food>getAll(String foodName){
        if(null==foodName|| foodName.trim().length()==0){
            return foodMapper.findAll();
        }
        return foodMapper.findByFoodName(foodName.trim());
    }
    @Override
    public void deleteById(Integer id){
        foodMapper.deleteById(id);
    }
}
